package com.bms.hystrix.service.jxgl;

import com.bms.hystrix.interfaces.jxgl.ErJiPingLunByCheck;
import com.bms.hystrix.pojo.ErJiPingLun;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @author zhangyujin
 * @version 1.0
 * @description erJIPingLunService.java
 * @date 2021/3/22 15:08
 */
@Service
public class ErJIPingLunService {
    @Resource
    private ErJiPingLunByCheck erJiPingLunByCheck;

    @HystrixCommand(fallbackMethod = "checkxinZengError")
    public Map xinZeng(@RequestBody ErJiPingLun erJiPingLun) {
          return erJiPingLunByCheck.xinZeng(erJiPingLun);
    }
    @HystrixCommand(fallbackMethod = "checkchaXunByIdError")
    public Map chaXunById(@RequestParam String id, @RequestParam Integer page) {
          return erJiPingLunByCheck.chaXunById(id,page);
    }

    @HystrixCommand(fallbackMethod = "shanChuByIdError")
    public Map<String, Object> shanChuById(String shanChuByIdAndShiPingId, String id) {
        return erJiPingLunByCheck.shanChuById(shanChuByIdAndShiPingId,id);
    }

    public Map<String, Object> chaxXunByTiaoJian(String name) {
        return erJiPingLunByCheck.chaxXunByTiaoJian(name);
    }
    public Map checkxinZengError(ErJiPingLun erJiPingLun) {
        Map map = new HashMap();
        map.put("code", 500);
        map.put("msg","服务异常，请稍后重试！");
        return map;
    }

    public Map<String, Object> chaXunByYiPingLunId(String id) {
        return erJiPingLunByCheck.chaXunByYiPingLunId(id);
    }

    public Map checkchaXunByIdError(String id, Integer page) {
        Map map = new HashMap();
        map.put("code", 500);
        map.put("msg","服务异常，请稍后重试！");
        return map;
    }
    public Map<String, Object> shanChuByIdError(String shanChuByIdAndShiPingId, String id){
        Map<String, Object> map = new HashMap();
        map.put("code", 500);
        map.put("msg","服务异常，请稍后重试！");
        return map;
    }



}
